﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" mc:Ignorable="d">

	<Style x:Key="CbrButtonBase" TargetType="{x:Type Button}">
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="Background" Value="{DynamicResource CbrBackgroundNormal}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushNormal}"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Border SnapsToDevicePixels="True"
						BorderThickness="1"
						BorderBrush="{TemplateBinding BorderBrush}" 
						Background="{TemplateBinding Background}">
						<Grid>
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
											  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushHighlighted}" />
							<Setter Property="Background" Value="{DynamicResource CbrBackgroundHighlighted}" />
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter Property="Background" Value="{DynamicResource CbrBackgroundSelected}"/>
							<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushSelected}"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Visibility" Value="Hidden"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="CbrStandardButton" TargetType="{x:Type Button}" BasedOn="{StaticResource CbrButtonBase}">
		<Setter Property="MinHeight" Value="22"/>
		<Setter Property="HorizontalContentAlignment" Value="Center"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
	</Style>

	<Style x:Key="CbrStandardButtonItem" TargetType="{x:Type Button}" BasedOn="{StaticResource CbrButtonBase}">
		<Setter Property="MinHeight" Value="22"/>
		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
	</Style>

	<Style x:Key="CbrLinkButton" TargetType="{x:Type Button}">
		<Setter Property="Cursor" Value="Hand"/>
		<Setter Property="Foreground" Value="{DynamicResource CbrLinkButtonForeground}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<TextBlock><InlineUIContainer>
							<ContentPresenter/>
						</InlineUIContainer></TextBlock>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Style.Triggers>
			<Trigger Property="IsMouseOver" Value="true">
				<Setter Property="Foreground" Value="{DynamicResource CbrLinkButtonForegroundHighlighted}" />
			</Trigger>
		</Style.Triggers>
	</Style>

	<Style x:Key="CbrToggleButton" TargetType="{x:Type ToggleButton}">
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="Background" Value="{DynamicResource CbrBackgroundNormal}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushNormal}"/>
		<Setter Property="OverridesDefaultStyle" Value="True"/>
		<Setter Property="SnapsToDevicePixels" Value="False"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ToggleButton}">
					<Border SnapsToDevicePixels="True"
						BorderThickness="1"
						BorderBrush="{TemplateBinding BorderBrush}" 
						Background="{TemplateBinding Background}">
						<Grid>
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
											  VerticalAlignment="{TemplateBinding VerticalAlignment}" />
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushHighlighted}" />
							<Setter Property="Background" Value="{DynamicResource CbrBackgroundHighlighted}" />
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter Property="Background" Value="{DynamicResource CbrBackgroundSelected}"/>
							<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushSelected}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="CbrRepeatButton" TargetType="{x:Type RepeatButton}">
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="Background" Value="{DynamicResource CbrBackgroundNormal}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource CbrLightBackground}"/>
		<Setter Property="OverridesDefaultStyle" Value="True"/>
		<Setter Property="SnapsToDevicePixels" Value="False"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Border SnapsToDevicePixels="True"
						BorderThickness="1"
						BorderBrush="{TemplateBinding BorderBrush}" 
						Background="{TemplateBinding Background}">
						<Grid>
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
											  VerticalAlignment="{TemplateBinding VerticalAlignment}" />
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushHighlighted}" />
							<Setter Property="Background" Value="{DynamicResource CbrBackgroundHighlighted}" />
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter Property="Background" Value="{DynamicResource CbrBackgroundSelected}"/>
							<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushSelected}"/>
						</Trigger>

					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="CbrRadioButton" TargetType="{x:Type RadioButton}">
		<Setter Property="Height" Value="16"/>
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource CbrBorderBrushNormal}"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<BulletDecorator Background="Transparent">
						<BulletDecorator.Bullet>
							<Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Height}" >
							<Ellipse Fill="{TemplateBinding BorderBrush}" />
							<Ellipse x:Name="select" Margin="3" Fill="{DynamicResource CbrBackgroundSelected}" Visibility="Hidden" />
							</Grid>
						</BulletDecorator.Bullet>
						<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
					</BulletDecorator>
					<ControlTemplate.Triggers>
						<Trigger Property="HasContent" Value="true">
							<Setter Property="Padding" Value="4,0,0,0"/>
						</Trigger>
						<Trigger Property="IsChecked" Value="true">
							<Setter TargetName="select" Property="Visibility" Value="Visible"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="CbrCheckBox" TargetType="{x:Type CheckBox}">
		<Setter Property="Height" Value="16"/>
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="Background" Value="{DynamicResource CbrBackgroundNormal}"/>
		<Setter Property="BorderBrush" Value="{StaticResource CbrBorderBrushNormal}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type CheckBox}">
					<BulletDecorator Background="Transparent" SnapsToDevicePixels="true">
						<BulletDecorator.Bullet>
							<Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Height}">
								<Path x:Name="check" Stretch="Fill" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{DynamicResource CbrBorderBrushNormal}">
									<Path.Data>
										<GeometryGroup>
											<LineGeometry StartPoint="0,3" EndPoint="4,8"/>
											<LineGeometry StartPoint="4,8" EndPoint="8,0"/>
										</GeometryGroup>
									</Path.Data>
								</Path>
							</Grid>	
						</BulletDecorator.Bullet>
						<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
					</BulletDecorator>
					<ControlTemplate.Triggers>
						<Trigger Property="HasContent" Value="true">
							<Setter Property="Padding" Value="4,0,0,0"/>
						</Trigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsMouseOver" Value="True"/>
								<Condition Property="IsChecked" Value="False"/>
								<Condition Property="IsEnabled" Value="True"/>
							</MultiTrigger.Conditions>
							<Setter Property="Stroke" TargetName="check" Value="{DynamicResource CbrBorderBrushHighlighted}"/>
						</MultiTrigger>
						<Trigger Property="IsChecked" Value="true">
							<Setter TargetName="check" Property="Stroke" Value="{DynamicResource CbrBackgroundSelected}"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
</ResourceDictionary>